package com.beiding.jsonanalyzer;

import com.beiding.jsonanalyzer.flow.ValueNode;

/**
 * @author 丁常磊
 * @date 2022/5/20 17:28
 */

public class AnalyzeValueNode extends ValueNode {

    /**
     * 如果父节点是MAP,该值为key
     */
    private String name;

    /**
     * 如果父节点是列表,该值为所在列表下标
     */
    private Integer index;

    /**
     * 当前节点的父节点对象
     */
    private AnalyzeValueNode parent;

    /**
     * 当前节点的KEY
     */
    private Key key;

    public String getName() {
        return name;
    }

    void setName(String name) {
        this.name = name;
    }

    public Integer getIndex() {
        return index;
    }

    void setIndex(Integer index) {
        this.index = index;
    }

    public AnalyzeValueNode getParent() {
        return parent;
    }

    void setParent(AnalyzeValueNode parent) {
        this.parent = parent;
    }

    public Key getKey() {
        return key;
    }

    void setKey(Key key) {
        this.key = key;
    }

    @Override
    public String toString() {
        return Analyzer.format(this.get());
    }
}
